#ifndef IXOBJECT
#define IXOBJECT
#include "Platform.h"
//All the base of class
class XM_ENTRY XObject{
protected:
	int i_ref;
	bool b_auto_recycle;
public:
	XObject(){
		i_ref = 1;
	};
	~XObject(){

	};
	//Init Object
	//virtual bool Init()=0;
	//Dispose Object
	virtual void Release(){
		i_ref--;
		if (i_ref <= 0 && b_auto_recycle)
			delete this;
	};
	//Retain Reference
	virtual void Retain(){
		i_ref++;
	};
	//Let the object goto auto recycle,but the object must be pointer
	virtual void SetAutoRec(){
		b_auto_recycle = true;
	};
	int GetRef(){
		return i_ref;
	}
	bool IsAutoRec(){
		return b_auto_recycle;
	}
	//Normal 'Get' Method
	//virtual std::string ToString()=0;
};
#endif 